<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2016/7/16 0016
  Time: 14:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <style>
        .num_error{  right:0.5rem; top:0; color:#cb1448;}
    </style>

    <c:choose>
        <c:when test="${userIdentity==1||returnResult==1}">
            <title>提交成功</title>
        </c:when>
      <c:otherwise>
          <title>代理商申请</title>
      </c:otherwise>
    </c:choose>
    <script src="${ctx}/assets/public_skin/js/jquery-1.11.1.min.js" type="text/javascript"></script>
    <script>
        $(function($){
            //填充省份下拉选
            $.getJSON("${ctx}/ajax/get_area?parentCode=", function(json){
                for(var i in json){
                    $("#addrProvinceCode").append("<option value='"+json[i].areaCode+"'>"+json[i].areaName+"</option>");
                }
            });
            //省份发生改变时，填充市级下拉选
            $("#addrProvinceCode").change(function () {
                //填充发货地省市名
                $("#addrProvinceName").val($("#addrProvinceCode option:selected").text());
                $("#addrCityCode option").remove();
                $("#addrCityCode").append("<option value=''>"+"请选择城市"+"</option>");
                var addrProvinceCode=$("#addrProvinceCode").val();
                if(addrProvinceCode!=0){
                    $.getJSON("${ctx}/ajax/get_area?parentCode="+addrProvinceCode, function(json){
                        for(var i in json){
                            //alert(json[i].areaName);
                            $("#addrCityCode").append("<option value='"+json[i].areaCode+"'>"+json[i].areaName+"</option>");}
                    });
                }
            });
            //市份发生改变时，填充区级下拉选
            $("#addrCityCode").change(function () {
                //填充发货地省市名
                $("#addrProvinceName").val($("#addrProvinceCode option:selected").text());
                $("#addrDistrictCode option").remove();
                $("#addrDistrictCode").append("<option value=''>"+"请选择区"+"</option>");
                var addrCityCode=$("#addrCityCode").val();
                if(addrCityCode!=0){
                    $.getJSON("${ctx}/ajax/get_area?parentCode="+addrCityCode, function(json){
                        for(var i in json){
                            //alert(json[i].areaName);
                            $("#addrDistrictCode").append("<option value='"+json[i].areaCode+"'>"+json[i].areaName+"</option>");}
                    });
                }
            });
        });
    </script>
    <script>
        function numberForm() {
            document.childForm.submit();
        }
    </script>
</head>
<body>
<c:choose>
    <c:when test="${userIdentity==1}">
        <article class="viewports">
            <div class="b-ffffff c3">
                <div class="pt30">
                    <div class="layout-box p40">
                        <div class="mr20">
                            <i class="ico-90 ico_zfok mt20"></i>
                        </div>
                        <div class="box-col">
                            <div class="mt20">您已经申请了代理商不能重复申请</div>
                            <div>感谢您的支持，马上安排人员跟您取得联系</div>
                        </div>
                    </div>
                </div>
                <div class="layout-box tac lh2">
                    <a class="box-col c3" href="${ctx}/my">返回会员中心</a>
                </div>
            </div>
        </article>
    </c:when>
    <c:when test="${returnResult==1}">
        <article class="viewports">
            <div class="b-ffffff c3">
                <div class="pt30">
                    <div class="layout-box p40">
                        <div class="mr20">
                            <i class="ico-90 ico_zfok mt20"></i>
                        </div>
                        <div class="box-col">
                            <div class="mt20">代理商申请提交成功</div>
                            <div>感谢您的支持，马上安排人员跟您取得联系。</div>
                        </div>
                    </div>
                </div>
                <div class="layout-box tac lh2">
                    <a class="box-col c3" href="${ctx}/my">返回会员中心</a>
                </div>
            </div>
        </article>
    </c:when>
    <c:otherwise>
<article class="viewports">
    <ul class="imglist01 lh1-5">
        <li class="odr_b mb10">
            <div class="c0"><i class="ico_tip b-ffaa3b"></i>代理商的优势：</div>
            <div class="c8 pl20">
                <p>1、拥有独家区域代理权限。</p>
                <p>2、可以获得推荐开微店的佣金奖励。</p>
                <p>3、免费拥有一个微商城店铺。</p>
            </div>
        </li>
        <li class="odr_b mb10">
            <div class="c0"><i class="ico_tip b-ffaa3b"></i>代理商的义务：</div>
            <div class="c8 pl20">
                <p>1、负责区域微店用户发展。</p>
                <p>2、负责指导区域微店卖家开展网上交易。</p>
                <p>3、负责区域微店卖家活动组织。</p>
            </div>
        </li>
     <form:form modelAttribute="UserAgentModel" method="post"  class="text-form" name="childForm">
        <li class="odr_b mb10">
            <div class="c0"><i class="ico_tip b-ffaa3b"></i>代理商申请：</div>
            <div class="c8">
                <div class="odr2 plr10 mt20">
                    <form:input  path="agentName" cssClass="i_text" placeholder="联系人"></form:input>
                    <%--<input class="i_text" type="text" value="" placeholder="联系人">--%>
                </div>
                <form:errors path="agentName" cssClass="num_error"></form:errors>
                <div class="odr2 plr10 mt20">
                    <form:input  path="phone" cssClass="i_text" placeholder="联系方式"></form:input>
                    <%--<input class="i_text" type="text" value="" placeholder="联系方式">--%>
                </div>
                <form:errors path="phone" cssClass="num_error"></form:errors>
                <div class="odr2 plr10 mt20" id="city_demo">
                        <span class="c0">
                       <form:select path="addrProvinceCode" class="s_text">
                           <form:option value="">--请选择省--</form:option>
                       </form:select>
                        <form:select path="addrCityCode" class="s_text">
                            <form:option value="">--请选择市--</form:option>
                        </form:select>
                        <form:select path="addrDistrictCode" class="s_text">
                            <form:option value="">--请选择区--</form:option>
                        </form:select>
                        <input id="value1" type="hidden" value="20,234,504"/>
                        </span>
                        <span class="r">
                        <i class="ico-30 ico_arrow"></i>
                        </span>
                </div>
                <form:errors path="addrProvinceCode" cssClass="num_error"></form:errors>
                <form:errors path="addrCityCode" cssClass="num_error"></form:errors>
                <form:errors path="addrDistrictCode" cssClass="num_error"></form:errors>
                <div class="odr2 p10 mt20">
                    <form:textarea  path="applyReason" cssClass="i_textarea" style="height:4rem;"  placeholder="简单介绍一下您成为代理商的优势和成为代理商之后的做法。"></form:textarea>
                    <%--<textarea class="i_textarea" style="height:4rem;" placeholder="简单介绍一下您成为代理商的优势和成为代理商之后的做法。"></textarea>--%>
                </div>
                <form:errors path="applyReason" cssClass="num_error"></form:errors>
            </div>
        </li>
    </ul>
</article>
<!--star 底下按钮-->
<div class="buy_height"></div>
<div class="p_fotbtn tac">
    <a class="b-2db22d cf ptb25" onclick="numberForm();">提交申请</a>
</div>
     </form:form>
<!--end 底下按钮-->
<%--<link href="public_skin/css/city/LArea.css" rel="stylesheet">--%>
<%--<script src="public_skin/js/city/LAreaData1.js"></script>--%>
<%--<script src="public_skin/js/city/LAreaData2.js"></script>--%>
<%--<script src="public_skin/js/city/LArea.js"></script>--%>
<script>
    var area1 = new LArea();
    area1.init({
        'trigger': '#city_demo', //触发选择控件的文本框，同时选择完毕后name属性输出到该位置
        'valueTo': '#value1', //选择完毕后id属性输出到该位置
        'keys': {
            id: 'id',
            name: 'name'
        }, //绑定数据源相关字段 id对应valueTo的value属性输出 name对应trigger的value属性输出
        'type': 1, //数据源类型
        'data': LAreaData //数据源
    });
    area1.value=[1,15,3];//控制初始位置，注意：该方法并不会影响到input的value
    var area2 = new LArea();
    area2.init({
        'trigger': '#demo2',
        'valueTo': '#value2',
        'keys': {
            id: 'value',
            name: 'text'
        },
        'type': 2,
        'data': [provs_data, citys_data, dists_data]
    });
</script>
    </c:otherwise></c:choose>
</body>
</html>
